/* 374. 猜数字大小 */

var guess = function (num) {}
/**
 * @param {number} n
 * @return {number}
 */
var guessNumber = function (n) {
	let left = 1,
		right = n
	while (left < right) {
		//循环至区间左右端点相同
		const mid = left + ((right - left) >> 1)
		/* 
            若guess(x) <= 0 x >= pick
            否则 x < pick

        */
		if (guess(mid) <= 0) {
			right = mid //答案在去区间 [left,mid]
		} else {
			left = mid + 1
		}
	}
	// 此时 left === right
	return left
}
